#include "MinimapContainterWidget.h"
#include <QPainter>

MinimapContainterWidget::MinimapContainterWidget(QWidget* parent)
	: QWidget(parent)
	, ui(new Ui::MinimapContainterWidgetClass())
{
	ui->setupUi(this);
	setMouseTracking(true);
	hide();
}

MinimapContainterWidget::~MinimapContainterWidget()
{
	delete ui;
}

void MinimapContainterWidget::setMinimapVisable(bool visable)
{
	ui->minimapWgt->setMinimapVisable(visable);
}

void MinimapContainterWidget::setScene(GraphicsScene* scene)
{
	ui->minimapWgt->setScene(scene);
}

void MinimapContainterWidget::onViewScaleChanged()
{
	ui->minimapWgt->onViewScaleChanged();
}

void MinimapContainterWidget::paintEvent(QPaintEvent* event)
{
	QPainter painter(this);
	painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
	painter.setBrush(QColor(40, 40, 40));
	painter.setPen(Qt::NoPen);
	painter.drawRoundedRect(rect(), 7, 7);
}
